package com.lww.consumer.feignclient;

import com.lww.springcloudapi.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "spring-cloud-provider-integral-8001")
@Repository
@RequestMapping("/commodity")
public interface TabCommodityFeignClient {
    /**
     * 根据商品名字进行模糊查询
     *
     * @param name
     * @return
     */
    @PostMapping("/QueryByName")
    @ApiOperation(value = "根据商品名字进行模糊查询")
    Result findQueryByName(@RequestBody String name,
                           @RequestParam(required = false, defaultValue = "1") Integer pageNo,
                           @RequestParam(required = false, defaultValue = "5") Integer pageSize);

    /**
     * 查找大于当前积分的所有商品 按照积分进行排序
     *
     * @param money
     * @return
     */
    @PostMapping("/QueryByGTMoney")
    @ApiOperation(value = "查找大于当前积分的所有商品 按照积分进行排序")
    public Result findQueryByGTMoney(@RequestBody Long money,
                                     @RequestParam(required = false, defaultValue = "1") Integer pageNo,
                                     @RequestParam(required = false, defaultValue = "5") Integer pageSize);

    /**
     * 查找小于当前积分的所有商品 按照积分进行排序
     *
     * @param money
     * @return
     */
    @PostMapping("/QueryByLTMoney")
    @ApiOperation(value = "查找小于当前积分的所有商品 按照积分进行排序")
    public Result findQueryByLTMoney(@RequestBody Long money,
                                     @RequestParam(required = false, defaultValue = "1") Integer pageNo,
                                     @RequestParam(required = false, defaultValue = "5") Integer pageSize);
}
